---
title: Build the current user's book of business
summary: Produces the "policy list" of policies visible to the current user, branching by user type and combining SQL Server, Oracle, and in-memory sources.
status: draft
owner: SAIF Claims BOF team
last_reviewed: 2026-08-21
library: SAIF.Business.View.Policy
reference_type: embedded
operation_id: OP-VP-003
trigger: First access to clsPolicySecurity.PolicyList property
---

# Build the current user's book of business

Lazily builds and caches the list of policies the current user is entitled to see, using a
different data source per user type.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-VP-003 |
| **Trigger** | First access to the `clsPolicySecurity.PolicyList` property |
| **Inputs** | Current `clsUserType` and its associated agent/group/loss-control/auditor identifiers |
| **Outputs** | `List(Of strPolicyList)` (policy number, name, formatted "number - name" string), cached in `m_PolicyList` |
| **Primary components** | `clsPolicySecurity.PolicyList`, `GetPolicyListForAgent`, `GetPolicyListforGroup`, `GetPolicyListForSafetyConsultant`, `GetPolicyListForFeeAuditor` |
| **Entry point** | `SAIF.Business.View.Policy\clsPolicySecurity.vb` |

## Steps

1. First access to the `PolicyList` property triggers a `Select Case` on `UserType.UserType`.
2. `Agent` → `GetPolicyListForAgent` executes
   [SQL-VP-036](../sql/SQL-036-getpolicylistforagent.md) — SQL Server stored procedure
   `cp_get_agent_online_policy_list` (parameters `@AgentNum`, `@ForAgency`).
3. `PolicyHolder` → iterates `PolicyDataForUser.AffiliatedPolicyCollection` (Oracle,
   `pk72846_view_policy.getpolicyaffiliatelist` via `clsAffiliatedPolicyCollection`) and builds the
   list directly from in-memory affiliated-policy data.
   - No additional SQL Server query is issued for this branch.
4. `LossControl` → `GetPolicyListForSafetyConsultant` executes
   [SQL-VP-035](../sql/SQL-035-getpolicylistforsafetyconsultant.md) — SQL Server stored procedure
   `cp_claimprofile_get_sc_book` (parameter `@losscontrol`).
5. `Group` → `GetPolicyListforGroup` executes
   [SQL-VP-034](../sql/SQL-034-getpolicylistforgroup.md) — SQL Server stored procedure
   `cp_claimprofile_get_group_policy_list` (parameters `@GroupKeyCode`, `@SpecificChapterCode`,
   `@rptDate`).
6. `Auditor` → `GetPolicyListForFeeAuditor` executes
   [SQL-VP-038](../sql/SQL-038-getauditorpolicylistsql.md) — inline Oracle SQL joining
   [PA_AUDIT](../database-tables.md#pa_audit), [PA_AUDITOR](../database-tables.md#pa_auditor), and
   [POLICY](../database-tables.md#policy) by vendor number, excluding not-yet-expired
   cancelled/completed audits, ordered by policy number.
7. Outcome: `List(Of strPolicyList)` cached in `m_PolicyList` for the life of the
   `clsPolicySecurity` instance.

## Process flow

```mermaid
flowchart TD
	Start([PolicyList accessed]) --> Branch{UserType?}
	Branch -->|Agent| Agent[GetPolicyListForAgent: SQL-VP-036]
	Branch -->|PolicyHolder| PH[Iterate AffiliatedPolicyCollection in memory]
	Branch -->|LossControl| LC[GetPolicyListForSafetyConsultant: SQL-VP-035]
	Branch -->|Group| Group[GetPolicyListforGroup: SQL-VP-034]
	Branch -->|Auditor| Auditor[GetPolicyListForFeeAuditor: SQL-VP-038]
	Agent --> Cache[Cache result in m_PolicyList]
	PH --> Cache
	LC --> Cache
	Group --> Cache
	Auditor --> Cache
	Cache --> EndOk([List Of strPolicyList returned])
```

## Failure and edge-case behavior
- The result is cached for the lifetime of the `clsPolicySecurity` instance; subsequent property accesses do not re-query.
- User types not covered by the branches above (e.g. `SaifEmployee`, `MCO`, `MedProv`, `Bookkeeper`) are not documented as producing a book-of-business list via this property in the analyzed source.*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts. Statements marked with `**` could not be confirmed; treat
> as unknown until verified.

## Sources
- `SAIF.Business.View.Policy\clsPolicySecurity.vb`
